package com.xs.ai.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.ai.chat.client.AdvisedRequest;
import org.springframework.ai.chat.client.RequestResponseAdvisor;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @description: 记录ai用户对话的日志拦截器，可用于数据分析等
 * @author liaohao
 * @createDate 2025/2/11 15:38
 **/
@Slf4j
@Component
public class LoggingAdvisor implements RequestResponseAdvisor {
    @Override
    public AdvisedRequest adviseRequest(AdvisedRequest request, Map<String, Object> context) {
        log.info("Request: {}", request);
//        log.info("Context: {}", context);
        return request;
    }
}
